package com.mgs.product.tagger.handlers
{
	import com.mgs.fwk.context.ApplicationContext;
	import com.mgs.fwk.handlers.ActionHandler;
	import com.mgs.product.tagger.controller.ContextController;
	import com.mgs.product.tagger.actions.AccessCellAction;
	import com.mgs.product.tagger.actions.ApplicationAction;
	import com.mgs.product.tagger.model.Segment;
	import com.mgs.product.tagger.ui.dto.NavigationContext;
	
	public class AccessCellHandler implements ActionHandler
	{
		public function AccessCellHandler()
		{
			//TODO: implement function
		}
		
		/**
		 * <u>AccessCellHandler</u> :<br/>
		 * Move the context to the cell. The context is updated according to the
		 * cell.
		 * @inheritDoc
		 */
		public function execute(context:ApplicationContext, action:ApplicationAction):void
		{
			var tags:Vector.<Segment> = new Vector.<Segment>();
			for each(var segment:Segment in (action as AccessCellAction).tags)
			{
				tags.push(segment);
			}
			(context as NavigationContext).activeTags = tags;
			(context as NavigationContext).invalidateActiveTags();
		}
	}
}